using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Orb : MonoBehaviour
{
    public GameObject ExplosionVFXPrefab;

    int player;
    void Start()
    {
        player = LayerMask.NameToLayer("Player");

        GameManager.Instance.RegisterOrb(this);
    }

    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.layer == player)
        {
            gameObject.SetActive(false);
            Instantiate(ExplosionVFXPrefab, transform.position, transform.rotation);
            AudioManager.Instance.PlayOrbAudio();
            GameManager.Instance.PlayerGrabOrb(this);
        }
    }
}
